PeachImage

PeachImage.Formats.Png.PngAlphaSplitInfo

PngAlphaSplitInfo(int, int, byte, byte[], byte[], byte, bool) Constructor

The result of splitting a PNG’s per-pixel alpha channel out into an independent plane. See TrySplit(PngPassthroughInfo, PngAlphaSplitInfo).

public PngAlphaSplitInfo(int Width, int Height, byte AlphaBitDepth, byte[] AlphaData, byte[]? ColorData, byte ColorBitDepth, bool ColorIsRgb);

Parameters

Width System.Int32

The image width in pixels.

Height System.Int32

The image height in pixels.

AlphaBitDepth System.Byte

The bit depth of each AlphaData sample. Always 8 in the current implementation.

AlphaData System.Byte[]

A complete, independent zlib (RFC 1950) stream of single-channel (DeviceGray) alpha samples, <b>PNG-filtered exactly like a PNG <c>IDAT</c> stream</b> — every row is prefixed with a filter-type byte (always 0/None here) followed by Width sample bytes, the same row shape a real PNG file’s own IDAT uses. This is deliberate, not raw flat pixel bytes: it lets a caller embed this stream as a PDF /FlateDecode/SMask with /DecodeParms << /Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns >> — PDF’s own “PNG prediction” mechanism, which a compliant PDF reader decodes identically to a real PNG row filter — the same technique already applies to IdatData itself (which keeps its original filter bytes verbatim), so this keeps both halves of a split image consistent with how PNG-sourced PDF image data is always framed.

ColorData System.Byte[]

A complete, independent zlib (RFC 1950) stream of the de-interleaved color samples (gray or RGB, per ColorIsRgb), framed exactly like AlphaData (a leading filter-type-None byte per row) — ready to embed as a PDF /FlateDecode color XObject stream with the matching /DecodeParms /Predictor 15 (/Colors 1 or 3 per ColorIsRgb). null when the source was a palette (indexed) image: in that case the color side needs no new data at all — pair the original IdatData and PaletteData with a PDF /Indexed color space as usual, and use only AlphaData from this result as the /SMask.

ColorBitDepth System.Byte

The bit depth of each ColorData sample, or 0 when ColorData is null.

ColorIsRgb System.Boolean

Whether ColorData holds 3-sample RGB pixels (source color type 6, TruecolorAlpha) as opposed to 1-sample grayscale pixels (source color type 4, GrayscaleAlpha). Meaningless when ColorData is null.